package com.sample.wanandroidx.adapter

import com.bumptech.glide.Glide
import com.sample.library.WebActivity
import com.sample.library.ext.ActivityMessenger.startActivity
import com.sample.wanandroidx.R
import com.youth.banner.adapter.BannerImageAdapter
import com.youth.banner.holder.BannerImageHolder

class BannerAdapter(mData: List<String>) : BannerImageAdapter<String>(mData) {
    override fun onBindView(holder: BannerImageHolder?, data: String?, position: Int, size: Int) {
        holder ?: return
        data ?: return
        holder.imageView.setOnClickListener {
            startActivity<WebActivity>(holder.imageView.context, "url" to data)
        }
        Glide.with(holder.imageView).load(data).centerCrop().placeholder(R.mipmap.ic_launcher).into(holder.imageView)
    }
}